Journals
  Publication Years
  Keywords
Search within results Open Search
Please wait a minute...
For Selected: Toggle Thumbnails
Static code defect detection method based on deep semantic fusion
Jingyun CHENG, Buhong WANG, Peng LUO
Journal of Computer Applications    2022, 42 (10): 3170-3176.   DOI: 10.11772/j.issn.1001-9081.2021081548
Abstract339)   HTML9)    PDF (2119KB)(123)       Save

With the increasing scale and complexity of computer softwares, code defect in software has become a serious threat to public safety. Aiming at the problems of poor expansibility of static analysis tools, as well as coarse detection granularity and unsatisfactory detection effect of existing methods, a static code defect detection method based on program slicing and semantic feature fusion was proposed. Firstly, key points in source code were analyzed through data flow and control flow, and the program slicing method based on Interprocedural Finite Distributive Subset (IFDS) was adopted to obtain the code snippet composed of multiple lines of statements related to code defects. Then, semantically related vector representation of code snippet was obtained by word embedding, so that the appropriate length of code snippet was selected with the accuracy guaranteed. Finally, Text Convolutional Neural Network (TextCNN) and Bi-directional Gate Recurrent Unit (BiGRU) were used to extract local key features and context sequence features of the code snippet respectively, and the proposed method was used to detect slice-level code defects. Experimental results show that the proposed method can detect different types of code defects effectively, and is significantly better than static analysis tool Flawfinder. Under the premise of fine granularity, IFDS slicing method can further improve F1 score and accuracy,reach 89.64% and 92.08% respectively. Compared with the existing methods based on program slicing, when key points are the Application Programming Interface (API) or the variables, the proposed method has the F1 score reached 89.69% and 89.74% respectively, and the accuracy reached 92.15% and 91.98% respectively, and all of them are higher. It can be seen that without significantly increasing time complexity, the proposed method has a better comprehensive detection performance.

Table and Figures | Reference | Related Articles | Metrics